export const REFRESH_TOKEN_REPOSITORY = Symbol('REFRESH_TOKEN_REPOSITORY');

export interface RefreshTokenData {
  userId: string;
  tokenId: string;
  expiresAt: Date;
  createdAt: Date;
  strategyName: string;
}

export interface IRefreshTokenRepository {
  /**
   * 保存refresh token
   */
  save(userId: string, tokenId: string, expiresAt: Date, strategyName: string): Promise<void>;

  /**
   * 验证refresh token是否有效
   */
  verify(userId: string, tokenId: string, strategyName: string): Promise<boolean>;

  /**
   * 删除用户的refresh token
   */
  revoke(userId: string, tokenId: string, strategyName: string): Promise<void>;

  /**
   * 删除用户所有的refresh token
   */
  revokeAll(userId: string, strategyName: string): Promise<void>;

  /**
   * 清理过期的refresh token
   */
  cleanExpired(): Promise<void>;
}
